<li id="choice_goods" style="display: list-item;">
	<label>商品:</label>
	<span class="mod-choose-input" id="choice_goods_wrap">
		<input type="text" class="ui-input" id="choice_goods_name" autocomplete="off">
		<span class="ui-icon-ellipsis" onclick="choice_goods()"></span>
	</span>
</li>
<input type="hidden" id="goods_id" value="" autocomplete="off" readonly="">
<script type="text/javascript">
	function choice_goods() {
		layer.open({
			type: 2,
			title: "选择商品",
			shadeClose: true,
			shade: 0.3,
			maxmin: false, //开启最大化最小化按钮
			area: ['795px', '550px'],
			fixed: false, //不固定
			btn: ['确定', '取消'],
			content: "/admin/basic/choose_goods.html",
			btn1: function (index, layero) {
				var body = layer.getChildFrame('body', index);
				//var goods_id = body.find('input[name="goodid"]:checked').val();
				//获取所有选中行
				var ids =  body.find("#grid").jqGrid('getGridParam','selarrrow');

				if (ids == '' || ids == null) {
					layer.msg("请选择商品");
					return false;
				} else {
					//alert(ids);
					//return false;
					//获取商品信息
					$.get("/admin/basic/one_goods.html", { ids: ids }, function (data, state) {
						console.log(data);
						if (data.status == 1) {
                            $("#choice_goods_name").val(data.info.names);
				 			$('#goods_id').val(data.info.ids);
						} else {
							layer.msg("获取信息失败");
						}
					})
				}

				// if (goods_id == '' || goods_id == null) {
				// 	layer.msg("请选择商品");
				// 	return false;
				// } else {
				// 	//获取商品信息
				// 	$.get("/admin/basic/one_goods.html", { id: goods_id }, function (data, state) {
				// 		if (data.status == 1) {
				// 			$("#choice_goods_name").val(data.info.sn + " " + data.info.name);
				// 			$('#goods_id').val(data.info.id);
				// 			layer.close(index);
				// 		} else {
				// 			layer.msg("获取商品信息失败");
				// 		}
				// 	})
				// }
				layer.close(index);
				return false;
			},
			btn4: function (index, layero) {
				layer.close(index);
				return false;
			}
		})
	}
</script>